<?php
namespace app\run\controller;
use app\common\model\Subscribe as subscribeModel;
class Subscribe extends Run{

		 public function index()
    	{  
	        // $sess = session('PHONE');
	        $res = subscribeModel::select();
	       	// pr($res);
	        $this->assign('res',$res);
	    	return $this->fetch();
    	}
    	public function find(){
    	 	$where['subscribe_id'] = input('id');
	        $where['subscribe_state'] = input('state');
	        // pr($where);die;
    		 $res = subscribeModel::edit($where);
    		 // pr($res);die;
    		 if(!$res)return 0;
    		return $res;
    	}
    	 public function select()
    	{  
	        // $sess = session('PHONE');
	        $id = input('goods_id');
	        $res = subscribeModel::find($id);
	       	// pr($res);
	        return $res;
    	}

    	 public function state()
    	{  
	        // $sess = session('PHONE');
	        $data['subscribe_id'] = input('id');
	        $data['subscribe_state'] = input('state');
	         $data['subscribe_result'] = input('result');
	        // pr($data);die;
	        $res = subscribeModel::updates($data);
	       	// pr($res);
	        if(!$res) return 0;
	        return 1;
    	}


}
